package com.study.springboot.model.bo;

import com.study.springboot.common.mvc.validate.Save;
import com.study.springboot.common.mvc.validate.Update;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.validator.constraints.Length;

import javax.validation.Valid;
import javax.validation.constraints.Email;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.List;

/**
 * @author wei.zhao
 * @description:
 * @date 2021年12月25日 10:43
 */
@Data
public class StudentBO implements Serializable {

    private static final long serialVersionUID = 1L;

    @NotNull(groups = {Update.class})
    @ApiModelProperty("id")
    private Long id;

    @NotNull(groups = {Update.class, Save.class})
    @Length(min = 2, max = 10, groups = {Update.class, Save.class})
    @ApiModelProperty(value = "姓名")
    private String name;

    @Min(value = 0, groups = {Update.class, Save.class})
    @Max(value = 200, groups = {Update.class, Save.class})
    @ApiModelProperty(value = "年龄")
    private Integer age;

    @Email(groups = {Update.class, Save.class})
    @ApiModelProperty(value = "邮箱")
    private String email;

    @Valid
    private List<UserBO> userBOS;

}
